(Quick Reference)

create-script

Purpose

The create-script command creates a new Grails code generation script that can be run with the grails command from a terminal window.

Examples

The command:

grails create-script my-script

Creates a script called src/main/scripts/my-script.groovy such as:

description "Example description", "grails example-usage"

println "Example Script"

The command can then be run with:

grails my-script

Description

Each script extends from the super class GroovyScriptCommand which provides an API for achieving a number of different tasks.

Invoking Gradle

You can invoke Gradle using the gradle property:

gradle.assemble()

You can run any other Grails scripts by simply invoking the method:

testApp()

Code generation can be performed using the TemplateRenderer API